<?php
class Ps extends Admin_Controller
{
	
	function __construct()
	{
		parent::__construct();
		$this->load->model('ps_model','ps');
	}
	
	function index($fund_id)
	{
		$this->load->model('voucher/fund_model','fund');
		$data['fund'] = $this->fund->get_row($fund_id);
		$data['rs'] = $this->db->getRow('select * from ps where fund_id = '.$fund_id);
		dbConvert($data['rs']);
		$this->template->build('ps_index',$data);
	}
	
	function save()
	{
		if($_POST)
		{
			add_log('แก้ไขหมายเหตุประกอบงบ');
			foreach($_POST['value'] as $key => $value)
			{
				$data['id'] = $key;
				$data['detail'] = $value;
				$this->ps->save($data);
				unset($data);
			}
			set_notify('success', lang('save_data_complete'));
		}
		redirect($_SERVER['HTTP_REFERER']);
	}
	
	
}
?>